﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK;

namespace Painter3D.RenderSys
{
    class CameraPerspective : Camera
    {
        /// <summary>
        /// 视角 deg
        /// </summary>
        public float fovy;

        /// <summary>
        /// 构造一个投影摄像机
        /// </summary>
        /// <param name="fovy">视角 deg</param>
        /// <param name="width">宽度</param>
        /// <param name="width">高度</param>
        /// <param name="transform">吸附的节点</param>
        /// <param name="nearPlane">近裁切平面</param>
        /// <param name="farPlane">远裁切平面</param>
        public CameraPerspective(float fovy, float width, float height, Transform transform, float nearPlane = 0.3f, float farPlane = 100.0f) : base(transform, width, height, nearPlane, farPlane)
        {
            this.fovy = fovy;
        }

        public override Matrix4 GetProjectMat()
        {
            return Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(fovy), width / height, nearPlane, farPlane);
        }
    }
}
